﻿@page "/actionbutton"
@using Gurux.DLMS.AMI.Shared.DTOs

<CascadingValue Value="this">
    <button type="button" class="button" onclick="@OnClick">
        @if (@Icon != null)
        {
        <div class="@Icon"></div>
        }
        @Text
    </button>
    @ChildContent
</CascadingValue>

@code {
    [Parameter]
    public RenderFragment ChildContent { get; set; }

    [CascadingParameter]
    private ObjectView Parent { get; set; }

    /// <summary>
    /// Button text.
    /// </summary>
    [Parameter]
    public string Text{ get; set; }

    /// <summary>
    /// Action index.
    /// </summary>
    [Parameter]
    public int Index{ get; set; }

    /// <summary>
    /// Button image.
    /// </summary>
    [Parameter]
    public string Icon { get; set; }

    /// <summary>
    /// Button clicked.
    /// </summary>
    [Parameter] public EventCallback<MouseEventArgs> OnClick { get; set; }
}
